#include "RdfsSax2Handler.h"
#include <iostream>
#include "xercesc/sax2/Attributes.hpp"
#include "xercesc/util/XMLUniDefs.hpp"

using  namespace std;

namespace xpm {
	RdfsSax2Handler::RdfsSax2Handler(Project* project): _project(project) {

	}

	RdfsSax2Handler::~RdfsSax2Handler() {

	}

	void RdfsSax2Handler::startDocument() {

	}

	void RdfsSax2Handler::endDocument() {

	}

	void RdfsSax2Handler::startElement(
		const   XMLCh* const    uri,
		const   XMLCh* const    localname,
		const   XMLCh* const    qname
		, const Attributes&	attrs) {
			/*const XMLCh* XPMDOC = XMLString::transcode("XPMDOC");
			const XMLCh* BLOCK = XMLString::transcode("Block");
			const XMLCh* TERM = XMLString::transcode("Term");			
			const XMLCh* POS = XMLString::transcode("pos");
			const XMLCh* LENGTH = XMLString::transcode("len");
			const XMLCh* IID = XMLString::transcode("iid");
			char tempStr[500];
			if(XMLString::equals(BLOCK, localname)) {
				_block = _doc->CreateBlockAtEnd();
				const XMLCh* pos = attrs.getValue(POS);
				int position;
				if(pos != 0 && *pos) {
					XMLString::transcode(pos, tempStr, 499);
					position = atoi(tempStr);					
				}
				_block->setTextBlockPos(position);
			}else if(XMLString::equals(TERM, localname) && _block) {
				const XMLCh* pos = attrs.getValue(POS);
				int position = -1;
				if(pos != 0 && *pos) {
					XMLString::transcode(pos, tempStr, 499);
					position = atoi(tempStr);					
				}
				const XMLCh* iid = attrs.getValue(IID);
				if(position >= 0 && iid != 0 && *iid) {
					XMLString::transcode(iid, tempStr, 499);
					if(_termControl) {
						conex::Term* term = _termControl->GetTermByIid(tempStr);
						if(term && _text.length() > 0) {
							_block->AppendTermRange(position, _text, term);
						}
					}
				}

			}	*/		
	}

	void RdfsSax2Handler::endElement(
		const XMLCh* const uri,
		const XMLCh* const localname,
		const XMLCh* const qname) {

	}

	void RdfsSax2Handler::characters (
		const   XMLCh* const    chars
		, const XMLSize_t       length ) {
	}
}
